#pragma once
#include <atlbase.h>

template<typename T> 
class CComPtrEx : public CComPtr<T>
{
public:
	 T* operator=(_Inout_opt_ T* lp) throw()
	 {
			if(*this!=lp)
			{
		  return static_cast<T*>(AtlComPtrAssign((IUnknown**)&p, lp));
			}
			return *this;
	 }
	 T** operator&() throw()
	 {
	  return &p;
	 }
};